home *** CD-ROM | disk | FTP | other *** search
/ Dioses Mayas / Dioses Mayas.iso / DEMO1 / LENTES / TITLE.MST < prev    next >
Text File  |  1996-06-07  |  16KB  |  484 lines

  1. '**************************************************************************
  2. '*
  3. '* Corear.MST - Viewer Runtime Setup Script
  4. '*
  5. '* CUSTOMIZING KimDEMO.MST
  6. '*
  7. '* For a simple Setup routine, you just need to assign values to the 
  8. '* series of variables following the heading "Setup Variables". This
  9. '* script also provides for the following more-advanced options, which
  10. '* are supported by subroutines located later in this script:
  11. '*
  12. '* Option                                         See Subroutine
  13. '* ------------------------------------------     ---------------------
  14. '* Install more than one .MVB file                ModifyViewerIni
  15. '* Install Help title                             ModifyViewerIni
  16. '* Install custom DLLs                            ModifyViewerIni
  17. '* Install multiple Program Manager items         ModifyProgramManager
  18. '* Display a custom icon with the ProgMan item    ModifyProgramManager
  19. '* Install custom fonts                           RegisterCustomFonts
  20. '* Install Video for Windows runtime files        RegisterDrivers
  21. '*
  22. '* Each customization note starts with the heading CUSTOMIZATION.
  23. '*
  24. '**************************************************************************
  25.     
  26.     '' Global variables
  27.  
  28.     GLOBAL TitleShortName$
  29.     GLOBAL TitleLongName$
  30.     GLOBAL Garabatos$
  31.     GLOBAL PromptForPath%
  32.     GLOBAL DefaultPath$
  33.     GLOBAL ProgManGroup$
  34.     GLOBAL ProgManItemGarabatos$
  35.  
  36.     '' ****************************************************************
  37.     '' ** Setup Variables
  38.     '' ****************************************************************
  39.  
  40.     '' Set the following string to a short form of the title name
  41.     '' (for example, "Gallery")
  42.     
  43.     TitleShortName$ = "Los Lentes Mßgicos"
  44.     
  45.     '' Set the following string to a long form of the title name
  46.     '' (for example, "Viewer 2.0 Gallery")
  47.     
  48.     TitleLongName$ = "El Paφs de las verduras - Los Lentes Mßgicos"
  49.         
  50.     '' Set the following variable to the name of the MVB file, without 
  51.     '' the filename extension (for example, "GALLERY")
  52.         
  53.     Garabatos$ = "LENTES"
  54.         
  55.     '' The following variable determines whether Setup prompts the user
  56.     '' to specify a directory in which to install title files. (Files
  57.     '' to be installed on the hard disk must be listed in the TITLE.INF 
  58.     '' file under the [Installed Title Files] section.) Specify one of
  59.     '' the following values:
  60.     ''
  61.     '' 0    Install title files in the Windows directory (default setting).
  62.     ''      This is an appropriate setting if you have a limited number
  63.     ''      of files to copy (for example, a single custom icon or DLL).
  64.     ''
  65.     '' 1    Display a dialog box to prompt the user for a directory in 
  66.     ''      which to install files
  67.         
  68.     PromptForPath% = 1
  69.         
  70.     '' If you have specified 1 in PromptForPath%, set the following 
  71.     '' variable to the default path that will be displayed in the dialog
  72.     '' box (for example, "C:\GALLERY").
  73.         
  74.     DefaultPath$ = "C:\CUENTOS\LENTES"
  75.     
  76.     '' Set the following variable to the name of the program manager 
  77.     '' group you would like to create (for example, "Viewer 2.0 Gallery")
  78.         
  79.     ProgManGroup$ = "EL PAIS DE LAS VERDURAS"
  80.     
  81.     '' Set the following variable to the caption of the program manager 
  82.     '' item for your title (for example, "Gallery")
  83.         
  84.     ProgManItemGarabatos$ = "Los Lentes Magicos"
  85.     
  86.     '***********************************************************************
  87.     '** Mainline
  88.     '***********************************************************************
  89.  
  90.     GLOBAL CUIDLL$
  91.  
  92.     '' Include files
  93.     '$INCLUDE 'setupapi.inc'
  94.     
  95.     '' Custom UI dll
  96.     CUIDLL$ = "mscuistf.dll"
  97.     
  98.     '' Dialog ID's
  99.     CONST DESTPATH      = 1000
  100.     CONST APPHELP       = 2000
  101.     CONST TOOBIG        = 3000
  102.     CONST BADPATH       = 4000
  103.     CONST SUCCESS       = 5000
  104.     
  105.     '' Bitmap ID
  106.     CONST LOGO = 1
  107.     
  108.     '' Functions and subroutines
  109.     DECLARE FUNCTION AddFont LIB "mscuistf.dll" (szFont$, szName$) AS INTEGER
  110.     DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  111.     DECLARE FUNCTION GetTitleDir (szDefault$) AS STRING
  112.     DECLARE FUNCTION CopyFiles(szTitleDir$) AS INTEGER
  113.     DECLARE SUB RegisterFont(fontfile$, fontname$)
  114.     DECLARE SUB ModifyViewerIni
  115.     DECLARE SUB RegisterCustomFonts
  116.     DECLARE SUB ModifyProgramManager
  117.     DECLARE SUB ShowSuccess
  118.     DECLARE SUB RegisterDrivers
  119.     
  120.     '' The following statement turns size checking off. Set it to scmOnFatal 
  121.     '' to enable size checking, where Setup will compare the disk file size 
  122.     '' with the INF file size and report an error if they are not the same.
  123.     
  124.     i% = SetSizeCheckMode(scmOff)
  125.     
  126.     '' Set the title and banner bitmap. You must rebuild MSCUISTF.DLL to 
  127.     '' alter the banner bitmap.
  128.     
  129.     SetTitle "El Paφs de las Verduras - Los Lentes Mßgicos"
  130.     SetBitmap CUIDLL$, LOGO 
  131.     
  132.     '' Read in the INF file.
  133.     
  134.     ReadInfFile GetSymbolValue("STF_CWDDIR") + "TITLE.INF"
  135.     
  136.     '' Decide where to put title files
  137.     IF PromptForPath% = 1 THEN
  138.         szTitleDir$ = GetTitleDir(DefaultPath$)
  139.                 DefaultPath$ = szTitleDir$
  140.         IF szTitleDir$ = "" THEN
  141.             GOTO QUIT
  142.         ENDIF
  143.     ELSE
  144.         szTitleDir$ = GetWindowsDir()
  145.     ENDIF   
  146.     
  147.     '' Copy files
  148.     IF CopyFiles(szTitleDir$) = 0 THEN
  149.         GOTO QUIT
  150.     ENDIF
  151.  
  152.     '' Create the MVIEWER2.EXE MVB association 
  153.     CreateIniKeyValue "WIN.INI", "Extensions", "MVB", "mviewer2.exe", cmoNone
  154.  
  155.     '' Register in VIEWER.INI
  156.     ModifyViewerIni
  157.  
  158.     '' Register custom fonts
  159.     RegisterCustomFonts
  160.  
  161.     '' Register drivers
  162.     RegisterDrivers
  163.     
  164.     '' Modify Program Manager
  165.     ModifyProgramManager    
  166.     
  167.     '' Success dialog
  168.     '' ShowSuccess
  169.     
  170.     '' Now start the title
  171.     '' RUN "mviewer2.exe " + MVBFileName$ + ".MVB", NOWAIT
  172.  
  173. QUIT:
  174.     
  175.     END
  176.     
  177.  
  178. '*************************************************************************
  179. '** Purpose:
  180. '**     Prompts the user for a path for the title files
  181. '** Arguments:
  182. '**     szDefault$ - default path
  183. '** Returns:
  184. '**     New valid path name, or "" if the user quit.
  185. '*************************************************************************
  186.  
  187. FUNCTION GetTitleDir (szDefault$) STATIC AS STRING
  188.  
  189.     SetSymbolValue "String", TitleShortName$
  190.     SetSymbolValue "EditTextIn", szDefault$
  191.     SetSymbolValue "EditFocus", "ALL"
  192.  
  193.     GETPATH:
  194.  
  195.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, "FHelpDlgProc")
  196.  
  197.     IF sz$ = "CONTINUE" THEN
  198.         szTitleDir$ = GetSymbolValue("EditTextOut")
  199.         IF IsDirWritable(szTitleDir$) = 0 THEN
  200.  
  201.             BADPATH:
  202.  
  203.             sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfoDlgProc", 0, "")
  204.             IF sz$ = "REACTIVATE" THEN
  205.                 GOTO BADPATH
  206.             END IF
  207.             UIPop 1
  208.             GOTO GETPATH
  209.         END IF
  210.         UIPop 1
  211.         CreateDir szTitleDir$, cmoNone
  212.     ELSEIF sz$ = "REACTIVATE" THEN
  213.         GOTO GETPATH
  214.  
  215.     ELSE
  216.         szTitleDir$ = ""
  217.  
  218.     END IF
  219.  
  220.     GetTitleDir = szTitleDir$
  221.  
  222. END FUNCTION
  223.  
  224.  
  225. '*************************************************************************
  226. '** Purpose:
  227. '**     Copies the files in the INF file
  228. '** Arguments:
  229. '**     szTitleDir$ - destination directory for the title files
  230. '** Returns
  231. '**     1 if files were copied, 0 otherwise
  232. '*************************************************************************
  233.  
  234. FUNCTION CopyFiles(szTitleDir$) STATIC AS INTEGER
  235.  
  236.     '' Add all system files to the copy list
  237.     AddSectionFilesToCopyList "System Files", GetSymbolValue("STF_SRCDIR"), GetWindowsSysDir()
  238.     
  239.     '' Add all of the title files to the copy list
  240.     AddSectionFilesToCopyList "Installed Title Files", GetSymbolValue("STF_SRCDIR"), szTitleDir$
  241.     
  242.     '' Check size
  243.     szExtras$ = "Extra"
  244.     szCosts$ = "Costs"
  245.     szNeededs$ = "Neededs"
  246.     FOR i% = 1 TO 26 STEP 1
  247.         AddListItem szExtras$, "0"
  248.     NEXT i%
  249.     
  250.     '' We assume that VIEWER.INI will take another 4K
  251.     ReplaceListItem szExtras$, ASC(MID$(GetWindowsDir(), 1, 1)) - ASC("A") + 1, STR$(4096)
  252.     
  253.     '' Get amount of space required
  254.     StillNeed& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
  255.     
  256.     '' Put up a message if there is not enough space
  257.     FOR i% = 1 TO 26 STEP 1
  258.         IF VAL(GetListItem(szNeededs$, i%)) > 0 THEN
  259.     
  260.             SetSymbolValue "String1", LTRIM$(STR$(VAL(GetListItem(szCosts$, i%)) / 1024))
  261.             SetSymbolValue "String2", CHR$(i% - 1 + ASC("A"))
  262.     
  263.             TOOBIG:
  264.     
  265.             sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfoDlgProc", 0, "")
  266.             IF sz$ = "REACTIVATE" THEN
  267.                 GOTO TOOBIG
  268.             END IF
  269.